package org.jeecg.enums.meter;

public enum MeterSwitchStatusEnum {
    METER_SWITCH_STATUS_ON(1, "通"),
    METER_SWITCH_STATUS_OFF(2, "断"),

    METER_SWITCH_STATUS_ON_ING(11, "送电/水中"),
    METER_SWITCH_STATUS_OFF_ING(22, "断电/水中");

    private Integer code;
    private String desc;

    MeterSwitchStatusEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public Integer getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }


    public static String getDesc(Integer value) {
        if (value == null) return "";
        MeterSwitchStatusEnum[] enums = values();
        for (MeterSwitchStatusEnum typeEnum : enums) {
            if (value.intValue() == typeEnum.getCode().intValue()) {
                return typeEnum.desc;
            }
        }
        return "";
    }

    public static Integer getValue(String desc) {
        MeterSwitchStatusEnum[] enums = values();
        for (MeterSwitchStatusEnum typeEnum : enums) {
            if (typeEnum.getDesc().equals(desc)) {
                return typeEnum.code;
            }
        }
        return null;
    }
}
